﻿/*
*VMukti -- An open source video conferencing platform.
*
* Copyright (C) 2007 - 2008, VMukti Solutions Pvt. Ltd.
*
* Hardik Sanghvi <hardik@vmukti.com>
*
* See http://www.vmukti.com for more information about
* the VMukti project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, forums and mailing lists
* for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
using System;

namespace VMukti.Bussiness.PBXConfiguration
{
    public class PBXConfiguration
    {
        VMukti.DataAccess.PBXConfiguration.ClsPBXDataService PBXDataService = new VMukti.DataAccess.PBXConfiguration.ClsPBXDataService();

        public void FncPBXBusinessInsertCredential(string PBXUserName, string PBXPassword, string PBXDomain)
        {
            try
            {
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                {
                    
                    VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("update PBXConfig set FieldValue= '" + PBXUserName + "' where Field='ProviderUserName'");
                    VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("update PBXConfig set FieldValue= '" + PBXPassword + "' where Field='ProviderPassword'");
                    VMukti.Business.clsDataBaseChannel.chHttpDataBaseService.svcExecuteDataSet("update PBXConfig set FieldValue= '" + PBXDomain + "' where Field='ProvideDomain'");
                }
                else
                {
                    PBXDataService.FncDataServicePBXConfigInsertValue(PBXUserName, PBXPassword, PBXDomain);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
    }
}
